Deprecate Text Completion API in AI SDK (work item 621038) - #10205
Conversation
Text completion (davinci) models are retired by Azure OpenAI. Deprecate the
Text Completion surface of the System Application AI module using the repo's
#if not CLEANxx + [Obsolete('...', '29.0')] convention:
- AzureOpenAI (7771): mark the 4 public GenerateTextCompletion overloads
[Obsolete] and guard with #if not CLEAN29.
- AzureOpenAIImpl (7772): guard the 4 internal GenerateTextCompletion
overloads, the GetTextMetaprompt / CheckTextCompletionMetaprompt helpers
and the text-completion-only labels with #if not CLEAN29.
- AOAI Text Completion Params (7765) and AOAI TextCompletionParams Impl
(7766): guard the whole objects with #if not CLEAN29.
- Guard the text-completion unit and partner tests with #if not CLEAN29.
The "AOAI Model Type"::"Text Completions" enum value and the shared
authorization / SendRequest plumbing are intentionally retained to avoid
AL0432 cascades from the generic multi-model methods; obsoleting the enum
value is left as a follow-up.
Verified: System Application compiles in both Default and Clean
(CLEAN25-29) modes with no new errors attributable to this change; the
remaining compile errors are environmental (missing platform .NET
assemblies) and require a BC platform/container. Runtime behaviour when AL
calls the Text Completion API must be verified on a devbox with CAPI access.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Codeunit 7765 "AOAI Text Completion Params" (and its internal implementation codeunit 7766 "AOAI TextCompletionParams Impl") is being fully retired behind Suggested fix (apply manually — could not be anchored as a one-click suggestion): codeunit 7765 "AOAI Text Completion Params"
{
Access = Public;
InherentEntitlements = X;
InherentPermissions = X;
ObsoleteState = Pending;
ObsoleteReason = 'Text completion (davinci) models are retired by Azure OpenAI. Use GenerateChatCompletion instead.';
ObsoleteTag = '29.0';Knowledge:
Line mapping was unavailable, so this was posted as an issue comment. 👍 useful · ❤️ especially valuable · 👎 wrong - reply with why · AL review agent v1.32.4 |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Deprecates the System Application AI module’s Azure OpenAI text-completion (legacy “davinci”/text completions) surface by marking the public API as obsolete and removing it from CLEAN29 builds, while retaining shared multi-model plumbing and the "AOAI Model Type"::"Text Completions" enum value for compatibility.
Changes:
- Wrapped text-completion public APIs, internal implementation helpers, and parameter objects in
#if not CLEAN29and added[Obsolete(..., '29.0')]/ObsoleteState=Pendingmetadata. - Guarded text-completion unit and partner tests with
#if not CLEAN29. - Scoped text-completion-only labels and metaprompt helpers behind
#if not CLEAN29in the implementation codeunit.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/System Application/App/AI/src/Azure OpenAI/AzureOpenAI.Codeunit.al | Marks the 4 public GenerateTextCompletion overloads as obsolete and removes them in CLEAN29 via #if not CLEAN29. |
| src/System Application/App/AI/src/Azure OpenAI/AzureOpenAIImpl.Codeunit.al | Guards text-completion-only labels, GenerateTextCompletion overloads, and metaprompt helpers behind #if not CLEAN29. |
| src/System Application/App/AI/src/Azure OpenAI/Text Completion/AOAITextCompletionParams.Codeunit.al | Guards the public text-completion params codeunit behind #if not CLEAN29 and marks it ObsoleteState=Pending (29.0). |
| src/System Application/App/AI/src/Azure OpenAI/Text Completion/AOAITextCompletionParamsImpl.Codeunit.al | Guards the internal params implementation codeunit behind #if not CLEAN29 and marks it ObsoleteState=Pending (29.0). |
| src/System Application/Test/AI/src/AzureOpenAITest.Codeunit.al | Wraps text-completion tests in #if not CLEAN29 so CLEAN29 builds don’t reference removed APIs. |
| src/System Application/Partner Test/AI/src/AzureOpenAITestPartner.Codeunit.al | Wraps partner text-completion test in #if not CLEAN29 for CLEAN29 compatibility. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: c254f0ef-9fef-4217-82f2-1de3980c1568
|
Addressed the automated object-obsoletion review in ObsoleteState = Pending;
ObsoleteReason = 'Text completion models are retired by Azure OpenAI. Use GenerateChatCompletion instead.';
ObsoleteTag = '29.0';Both codeunits 7765 and 7766 now carry the metadata before The initial patch guarded removal without first marking the objects Pending; the feedback follow-up corrected that staging. Useful detection signal: when a public object is placed behind a new CLEAN guard, verify object-level Pending metadata exists outside the clean-removal behavior so normal builds provide a warning window. |
The Text Completion deprecation left the AI test codeunits failing to compile
in CI:
- Clean (CLEAN29 defined): guard the declarations that were only referenced by
already-guarded code, so they are not flagged as unused:
- AzureOpenAITest: BillingTypeAuthorizationErr label (AA0137).
- AzureOpenAITestPartner: using System.TestLibraries.AI (AL0792).
- Default (CLEAN29 not defined): the guarded text-completion tests call the
newly [Obsolete('...', '29.0')] GenerateTextCompletion overloads, which trips
AL0432. Wrap those blocks in #pragma warning disable/restore AL0432, mirroring
the App-side AzureOpenAI / AzureOpenAIImpl pattern.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Thaddeus Loke (thloke)
left a comment
There was a problem hiding this comment.
We are using this in a demo page as well, maybe we should remove it there too. It's not critical though, just a dangling reference.
Text completion (davinci) models are retired by Azure OpenAI. Deprecate the Text Completion surface of the System Application AI module using the repo's #if not CLEANxx + [Obsolete('...', '29.0')] convention:
The "AOAI Model Type"::"Text Completions" enum value and the shared authorization / SendRequest plumbing are intentionally retained to avoid AL0432 cascades from the generic multi-model methods; obsoleting the enum value is left as a follow-up.
Verified: System Application compiles in both Default and Clean (CLEAN25-29) modes with no new errors attributable to this change; the remaining compile errors are environmental (missing platform .NET assemblies) and require a BC platform/container. Runtime behaviour when AL calls the Text Completion API must be verified on a devbox with CAPI access.
Cerified on a devbox. The agent created and published a disposable AL extension to a local NAV NST configured to use the standalone Copilot Service connected to CAPI.
The extension executed Azure OpenAI.GenerateTextCompletion from an AL background session, exercising the complete path:
AL → NAV NST → Copilot Service → CAPI
The request returned 200 OK with the expected completion. This confirms that the deprecated API remains runtime-compatible before CLEAN29 , while the [Obsolete] annotation warns consumers to migrate and the CLEAN29 build removes the API
What & why
Linked work
AB#620033
Fixes #
How I validated this
What I tested and the outcome (required — be specific: scenarios, commands, screenshots for UI changes)
Risk & compatibility